

//
//  LYRollController.m
//  SelectCity
//
//  Created by liuyan on 2019/3/17.
//  Copyright © 2019年 liuyan. All rights reserved.
//

#import "LYRollController.h"
#import "LYRollView.h"
#import "LYDoubleRollView.h"

@interface LYRollController ()

@property (nonatomic, strong) NSArray *dataArray;
@property (nonatomic, strong) LYRollView *lineNewsView;
@property (nonatomic, strong) LYDoubleRollView *scrollview;

@end

@implementation LYRollController

-(NSArray *)dataArray{
    if (!_dataArray) {
        _dataArray = @[@"12345",@"你好",@"你好12",@"你好34",@"你好56",@"你好78",@"你好910",@"你好1011",@"你好1112",@"你好1213"];
    }
    return _dataArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self createSubview];
}

- (void)createSubview{
    _lineNewsView = [[LYRollView alloc] initWithFrame: CGRectMake(30, 100, WIDTH - 45, 36.0)];
    _lineNewsView.backgroundColor = [UIColor redColor];
    __weak typeof(self) weakSelf = self;
    _lineNewsView.titleArr = self.dataArray;
    _lineNewsView.block = ^(NSInteger index){
        [weakSelf rollViewDidClicked:index];
    };
    [self.view addSubview:_lineNewsView];
    
    
    _scrollview = [[LYDoubleRollView alloc] initWithFrame: CGRectMake(30, 220, WIDTH - 45, 36)];
    _scrollview.titleArr = self.dataArray;
    _scrollview.block = ^(NSInteger index){
        [weakSelf rollViewDidClicked:index];
    };
    [self.view addSubview:_scrollview];
}

- (void)rollViewDidClicked:(NSInteger)index{
    self.title = self.dataArray[index];
}
    


@end
